<?php

namespace app\admin\model\lands;

use think\Model;


class Land extends Model
{

    

    

    // 表名
    protected $name = 'land';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'ares_status_text',
        'duration_text',
        'property_text',
        'utypes_text',
        'see_text',
        'status_text'
    ];
    

    
    public function getAresStatusList()
    {
        return ['1' => __('Ares_status 1'), '2' => __('Ares_status 2')];
    }

    public function getDurationList()
    {
        return ['1' => __('Duration 1'), '2' => __('Duration 2')];
    }

    public function getPropertyList()
    {
        return ['1' => __('Property 1'), '2' => __('Property 2')];
    }

    public function getUtypesList()
    {
        return ['1' => __('Utypes 1'), '2' => __('Utypes 2'), '3' => __('Utypes 3')];
    }

    public function getSeeList()
    {
        return ['1' => __('See 1'), '2' => __('See 2')];
    }

    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')];
    }


    public function getAresStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['ares_status']) ? $data['ares_status'] : '');
        $list = $this->getAresStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getDurationTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['duration']) ? $data['duration'] : '');
        $list = $this->getDurationList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getPropertyTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['property']) ? $data['property'] : '');
        $list = $this->getPropertyList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getUtypesTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['utypes']) ? $data['utypes'] : '');
        $list = $this->getUtypesList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getSeeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['see']) ? $data['see'] : '');
        $list = $this->getSeeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function user()
    {
        return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
